package com.security.dataprocess.service.impl;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.security.dataprocess.mapper.EnterpriseWarehouseMapper;
import com.security.dataprocess.model.EnterpriseWarehouse;
import com.security.dataprocess.service.IEnterpriseWarehouseService;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 产废企业仓库信息表 服务实现类
 * </p>
 *
 * @author H
 * @since 2022-12-19
 */
@Service
@DS("mysql2")
public class EnterpriseWarehouseServiceImpl extends ServiceImpl<EnterpriseWarehouseMapper, EnterpriseWarehouse> implements IEnterpriseWarehouseService {

    @Override
    public  IPage<EnterpriseWarehouse> findListByPage(Integer page, Integer pageCount){
        IPage<EnterpriseWarehouse> wherePage = new Page<>(page, pageCount);
        EnterpriseWarehouse where = new EnterpriseWarehouse();

        return   baseMapper.selectPage(wherePage, Wrappers.query(where));
    }

    @Override
    public int add(EnterpriseWarehouse enterpriseWarehouse){
        return baseMapper.insert(enterpriseWarehouse);
    }

    @Override
    public int delete(Long id){
        return baseMapper.deleteById(id);
    }

    @Override
    public int updateData(EnterpriseWarehouse enterpriseWarehouse){
        return baseMapper.updateById(enterpriseWarehouse);
    }

    @Override
    public EnterpriseWarehouse findById(Long id){
        return  baseMapper.selectById(id);
    }
}
